//
//  AFBlockController.m
//  BlockTest
//
//  Created by 崔宝印 on 2017/12/8.
//  Copyright © 2017年 Koolearn. All rights reserved.
//

#import "AFBlockController.h"
#import "AFHTTPSessionManager.h"

@interface AFBlockController ()
@property (nonatomic, strong) NSMutableArray *testArray;
@end

@implementation AFBlockController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.testArray = [NSMutableArray array];
    
    [[AFHTTPSessionManager manager] POST:@"https://www.koolearn.com" parameters:nil progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        [self.testArray addObject:@"123"];
        dispatch_async(dispatch_get_global_queue(0, 0), ^{
            for (int i = 0; i < 30000; i++)
            {
                NSLog(@"%d:%@",i,self.testArray );
            }
        });
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        [self.testArray addObject:@"321"];
        dispatch_async(dispatch_get_global_queue(0, 0), ^{
            for (int i = 0; i < 30000; i++)
            {
                NSLog(@"%d:%@",i,self.testArray );
            }
        });
    }];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

}

- (void)dealloc
{
    NSLog(@"%s",__func__);
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
